﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Security;
using YTCMS.Domain.Entities;

namespace App.Common
{
    public class WZTContext
    {
        public static users current
        {
            get
            {

                HttpCookie authCookie = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName];
                if (authCookie == null || authCookie.Value == "")
                    return new users();
                else
                {
                    FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
                    string userData = authTicket.UserData;
                    var user = Newtonsoft.Json.JsonConvert.DeserializeObject<users>(userData);
                    return user;
                }
            }
        }

       
    }
}